//
//  KFXFViewController.m
//  Rong360
//
//  Created by tianliwei on 28/2/14.
//  Copyright (c) 2014 tianliwei. All rights reserved.
//

#import "KFXFViewController.h"
#import "KFXFCell.h"
#import "WebViewController.h"
#import "ZXKFTVewController.h"
#import "RealEstateQaViewController.h"
#import "EvaluateCalculatorViewController.h"
@interface KFXFViewController ()
@property (nonatomic, strong)NSArray *imageTitles;
@property (nonatomic, strong)NSArray *mainTitles;
@property (nonatomic, strong)NSArray *subTitles;
@end

static NSString *CellIdentifier = @"Cell";


@implementation KFXFViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"看房选房";
    self.imageTitles = @[@"kfxf_1",@"kfxf_2",@"kfxf_3",@"kfxf_4",@"kfxf_6"];
    self.mainTitles = @[@"我能买房吗",@"我能买多大的房子",@"新房二手房对比",@"挑选房产",@"最新看房团"];//@"学区房查询",
    self.subTitles = @[@"是否被限购，购房资格自查",@"评估购房能力，看你能买多大房",@"全面对比，新房二手房怎么选",@"楼层户型，周边环境怎么看，如何选",@"优惠！汇集房产网站最新看房团"];//@"优惠！汇集房产网站最新看房团",
    [self.tableView registerNib:[UINib nibWithNibName:@"KFXFCell" bundle:nil] forCellReuseIdentifier:CellIdentifier];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.rowHeight = 66;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.mainTitles.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    KFXFCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    cell.mainLabel.text = self.mainTitles[indexPath.row];
    cell.subLabel.text = self.subTitles[indexPath.row];
    cell.thumbImg.image = [UIImage imageNamed:self.imageTitles[indexPath.row]];
    return cell;
}


#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    self.hidesBottomBarWhenPushed = YES;
    switch (indexPath.row) {
        case 0:{
            RealEstateQaViewController *realVC = [[RealEstateQaViewController alloc]init];
            [self.navigationController pushViewController:realVC animated:YES];
            break;
        }
        case 1:{
            EvaluateCalculatorViewController *evaluVC = [[EvaluateCalculatorViewController alloc]init];
            [self.navigationController pushViewController:evaluVC animated:YES];
            break;
        }
        case 2:{
            WebViewController *webVC = [[WebViewController alloc]initWithUrl:XFESFDB title:self.mainTitles[indexPath.row] desc:XFESFDBDesc];
            webVC.type = HTML5ShareUrl;
            [self.navigationController pushViewController:webVC animated:YES];
            break;
        }
        case 3:{
            WebViewController *webVC = [[WebViewController alloc]initWithUrl:TXFC title:self.mainTitles[indexPath.row] desc:TXFCDesc];
            webVC.type = HTML5ShareUrl;
            [self.navigationController pushViewController:webVC animated:YES];
            break;
        }
        case 4:{
            ZXKFTVewController *zxkftVC = [[ZXKFTVewController alloc]init];
            [self.navigationController pushViewController:zxkftVC animated:YES];
            break;
        }
        default:
            break;
    }
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
